<?php
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
//use mobile\assets\AppAsset;
use yii\widgets\LinkPager;
use mobile\controllers\SiteController;
use common\models\member\Member;
use common\models\category\Category;
use common\models\articles\Articles;
use common\models\art\Art;
use common\models\meeting\Meeting;
use common\models\FriendLink\FriendLink;
use common\models\LinkType\LinkType;
use common\models\Fenhuigrade\Fenhuigrade;
use common\models\Ad\AdPosition;
use common\models\Ad\Ad;
use common\models\setting\Setting;


$cwanews =Articles::find()->where(['category_id'=>7,'status'=>10])->limit(4)->asArray()->all();
$inanews =Articles::find()->where(['category_id'=>8,'status'=>10])->limit(3)->asArray()->all();
$ovnews =Articles::find()->where(['category_id'=>9,'status'=>10])->limit(5)->asArray()->all();
$cenews =Articles::find()->where(['category_id'=>11,'status'=>10])->limit(5)->asArray()->all();


?>
<?php 

$guanggao = Ad::find()->where(['position_id'=>6])->asArray()->all();//首页banner广告位
$morenguang = Ad::find()->where(['position_id'=>9])->one();//首页banner默认广告位

//网站logo
$imgLOGO = '';
try { $imgLOGO = Setting::findOne(['code'=>'imgLOGO'])->value;}
catch(ErrorException $e){ }
//网站名称
$name = '';
try
{ $name = Setting::findOne(['code'=>'siteName'])->value;}
catch(ErrorException $e) { }
$fenhuio = Fenhuigrade::find()->where(['status'=>10])->one();

?>
<!--slide-->
<div id="focus" class="focus">
    <div class="hd">
        <ul>
        </ul>
    </div>
    <div class="bd">
        <ul id="Gallery" class="gallery">
            <?php foreach($guanggao as $gg){ ?>
            <li>
                <a href="<?= $gg['ad_link']; ?>"><img src="<?=Yii::$app->params['setshow']?><?= json_decode($gg['ad_code'], true)['newname'];?>"></a>
                <span class="slititte"><?= $gg['ad_name']; ?></span>
            </li>
            <?php } ?>
        </ul>
    </div>
</div>
<script>
    /*banner滚动图片*/
    TouchSlide({
        slideCell : "#focus",
        titCell : ".hd ul", // 开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
        mainCell : ".bd ul",
        effect : "leftLoop",
        autoPlay : true, // 自动播放
        autoPage : true, // 自动分页
        delayTime: 200, // 毫秒；切换效果持续时间（执行一次效果用多少毫秒）
        interTime: 2500, // 毫秒；自动运行间隔（隔多少毫秒后执行下一个效果）
        switchLoad : "_src" // 切换加载，真实图片路径为"_src"
    });
</script>
<!--slide end-->
<!--新闻动态-->
<div class="clearFloat bag-fff m-t-27">
    <div class="innews m-l-35 m-r-35">
        <h3 class="nwdth3"><img src="images/xwicon.png" alt="" class="xwicon"> CWA News

        </h3>
        <div class="hot-content">
            <ul class="clearFloat">
        <?php foreach($cwanews as $cw ){?>
                <a href="<?= yii\helpers\Url::to(['list/newscontent','id' => $cw['id'],'z_nav'=>0]); ?>">
                    <li>
                        <div class="hto-img">
                            <div class="hto-p">
                                <h3 class="hto-ph3"><?=$cw['title'] ?></h3>
                                <p class="hto-title clearFloat"><?= date('Y-m-d H:i',$cw['created_at']);?></p>
                            </div>
                            <div class="hto-img-content">
                                <img src="<?= Yii::$app->params['ueditor'] ?>/upload/<?= json_decode($cw['img'], true)['newname'];?>" alt=""/>
                            </div>
                        </div>
                    </li>
                </a>
        <?php } ?>
            </ul>            
        </div>       
    </div>
    <a href="<?= yii\helpers\Url::to(['list/news','id' => 7,'z_nav'=>0]); ?>" class="ggmore">More...</a>
</div>

<div class="clearFloat bag-fff">
    <div class="ingg m-l-35 m-r-35">
        <h3 class="nwdth3"><img src="images/xwicon2.png" alt="" class="xwicon"> Industry News
        </h3>
        <div class="nwgglist">
            <ul>
        <?php foreach ($inanews as $in){ ?>
                <a href="<?= yii\helpers\Url::to(['list/newscontent','id' => $in['id'],'z_nav'=>0]); ?>">
                    <li>
                        <div class="nelip">
                            <?=$in['title']?> <span>(<?= date('m-d',$in['created_at']);?>)</span>
                        </div>
                    </li>
                </a>
        <?php } ?>
            </ul>
        </div>
    </div>
    <a href="<?= yii\helpers\Url::to(['list/news','id'=>7,'z_nav'=>0]);?>" class="ggmore">More...</a>
</div>
<!--公告-->
<!--公告-->
<div class="clearFloat bag-fff">
    <div class="ingg m-l-35 m-r-35">
        <h3 class="nwdth3"><img src="images/xwicon3.png" alt="" class="xwicon"> Overseas News
        </h3>
        <div class="nwgglist">
            <ul>
         <?php foreach($ovnews as $ov){ ?>
                <a href="<?= yii\helpers\Url::to(['list/newscontent','id' => $ov['id'],'z_nav'=>0]); ?>">
                    <li>
                        <div class="nelip">
                           <?=$ov['title'] ?> <span>(<?= date('m-d',$ov['created_at']);?>)</span>
                        </div>
                    </li>
                </a>
         <?php } ?>
            </ul>
        </div>
    </div>
    <a href="<?= yii\helpers\Url::to(['list/news','id' => 9,'z_nav'=>0]); ?>" class="ggmore">More...</a>
</div>

<div class="clearFloat bag-fff">
    <div class="ingg m-l-35 m-r-35">
        <h3 class="nwdth3"><img src="images/xwicon5.png" alt="" class="xwicon"> CWA Events
        </h3>
        <div class="nwgglist">
            <ul>
         <?php foreach($cenews as $ce){?>
                <a href="<?= yii\helpers\Url::to(['list/newscontent','id' => $ce['id'],'z_nav'=>0]); ?>">
                    <li>
                        <div class="nelip">
                           <?=$ce['title'] ?> <span>(<?= date('m-d',$ce['created_at']);?>)</span>
                        </div>
                    </li>
                </a>
         <?php } ?>
            </ul>
        </div>
    </div>
    <a href="<?= yii\helpers\Url::to(['list/news','id' => 11,'z_nav'=>0]); ?>" class="ggmore">More...</a>
</div>


